package game;

public class Lock {

	public boolean isLocked = false;

	public synchronized void lock() throws InterruptedException {
		while (isLocked) {
			wait();
		}
		isLocked = true;
	}

	public synchronized void unlock() {
		if (isLocked) {
			isLocked = false;
			notify();
		}
	}
}